package mest.controller.Modeling;


import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import mest.entity.warehousesave_manytomany;
import mest.service.Modeling.warehousesave_manytomany_recordService;
import mest.service.system.DBService;
import mest.util.mestUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;

@RestController
@CrossOrigin
@RequestMapping(value = "/warehousesave_manytomany_record")
public class warehousesave_manytomany_recordController {
    @Resource
    private warehousesave_manytomany_recordService wmr;


    @Autowired
    private DBService dbService;

    //新增仓库操作记录warehousesave_manytomany wsmtm,String theirDb
    public String insertModel(@RequestBody JSONObject json,HttpServletRequest request){
        String theirDb = mestUtil.getCompanyDB(request);
        Integer userId = dbService.getUserId(); //获取操作人ID
        warehousesave_manytomany wsmtm = json.toJavaObject(warehousesave_manytomany.class);
        return wmr.insertModel(wsmtm,theirDb,userId);
    }

}
